﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.ZY
{
    class Class10
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            string a = ppa.PolicyActing.Policy.SelectedColRateFactors["领取年龄"];
            int receiveAge = int.Parse(a.Substring(0, 2));

            if(ppa.Age>=receiveAge && ppa.Age < 88)
            {
                da.Value = ppa.Amount * 12 ;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age ==88)
            {
                da.Value = ppa.Amount * 88;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {


            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故") || ppa.SchemePeriodActing.InsurantStates.Contains("意外身故"))
            {
                string a = ppa.PolicyActing.Policy.SelectedColRateFactors["领取年龄"];
                int receiveAge = int.Parse(a.Substring(0, 2));

                if (ppa.Age >= receiveAge)
                {
                    da.Value = (88 - ppa.Age) * ppa.Amount * 12 + ppa.Amount * 88;
                }
                else
                {
                    da.Value = ppa.TotalFee;
                }

                if (ppa.SchemePeriodActing.InsurantStates.Contains("意外身故") && ppa.Age >= 18)
                {
                    const double max = 300000;
                    double tmp = ppa.Amount * 300;
                    double tmp2 = tmp > max ? max : tmp;
                    da.Value += tmp2;
                }
                ppa.IsCurrentFinish = true;
            }

        }
    }
}
